package example;

import org.example.domain.Student;
import org.example.service.StudentService;
import org.example.service.impl.StudentServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class MyTest02 {
    @Test
    public void test01(){
        String config="applicationContext.xml";
        ApplicationContext ctx=new ClassPathXmlApplicationContext(config);
        StudentService studentService= ctx.getBean(StudentServiceImpl.class);

        Student student=new Student();
        student.setAge(20);
        student.setName("def");
        studentService.addStudent(student);

        List<Student> students=studentService.queryStudent();
        for (Student stu : students) {
            System.out.println(stu);
        }
    }
}
